package chapter07_object;

/**
 * ClassName: PersonTest
 * Package: chapter07_object
 * Description:
 *
 * @Author 安思宇
 * @Create 2025/7/16 17:21
 */
public class PersonTest {
    public static void main(String[] args) {
        Person1 p1=new Person1("Sherry","195@163.com");
        p1.setAge(10);
        System.out.println(p1.getAge());
        Person1 p2=new Person1("Tom","123@163.com");
        System.out.println(p2.name+p2.email);
        p2.setAge(20);
        System.out.println(p2.getAge());
    }
}

class Person1{
    String name;
    int age;
    String email;

    Person1(String name,String email){//构造器
        this.name=name;
        this.email=email;
    }
    public void setAge(int age){
        this.age=age;//谁是属性谁加this
    }
    public int getAge(){
        return this.age;
    }
}

